FROM maven:3.8-jdk-8 As buildStage
WORKDIR /app/src
COPY . .
RUN  mkdir -p $HOME/.m2/; \
    mv settings.xml $HOME/.m2/; \
    mvn clean package -Dmaven.test.skip=true;

FROM openjdk:8-alpine
WORKDIR /app
COPY --from=buildStage /app/src/target/demo-0.0.1-SNAPSHOT.jar /app/
EXPOSE 8080
CMD java -jar demo-0.0.1-SNAPSHOT.jar